package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(30);unique"` //用户
	Password string `gorm:"type:varchar(32)"`        //密码
}

func (u *User) Create() error {
	return DB.Create(&u).Error
}

func (u *User) GetInfoByUsername(username string) error {
	return DB.Where("username = ?", username).Limit(1).Find(&u).Error
}
